package cn.zkrt.iotms.feign.token;


import cn.zkrt.iotms.config.FeignTokenSupportConfig;
import org.springframework.stereotype.Component;

@Component
public class TokenContext {

    private String currentToken;

    public String getCurrentToken() {
        // 这里可以从缓存、数据库或者其他数据源获取 token
        if (currentToken == null || isTokenExpired()) {
            currentToken = fetchNewToken();
        }
        return currentToken;
    }

    private boolean isTokenExpired() {
        // 判断 token 是否过期的逻辑
        return false;
    }

    private String fetchNewToken() {
        // 获取新 token 的逻辑
        return FeignTokenSupportConfig.SPECIAL_AUTHORIZATION;
    }


    public void setCurrentToken(String s) {
        this.currentToken = s;
    }
}
